]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
screenshot: Get cursor texture from window
authorIvan Molodetskikh <yalterz@gmail.com>
Sun, 19 Mar 2023 04:45:41 +0000 (21:45 -0700)
committerIvan Molodetskikh <yalterz@gmail.com>
Tue, 21 Mar 2023 16:46:52 +0000 (09:46 -0700)
When a window is in the background and should not have the cursor on top
of it, its _cursor will be null. By getting the texture through it, we
add this extra check, which was missing before, leading to a cursor
drawn at 0, 0 on windows where it should not have been drawn.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2702>

js/ui/screenshot.js

index 59c63c71e16a34d7c226c499c87a66d79f2a52e7..ecbe50bcca9adb2b18d61082928ba6a9b9ca4249 100644 (file)
@@ -917,6 +917,10 @@ class UIWindowSelectorWindow extends St.Button {
         this.insert_child_below(this._cursor, this._border);
     }
 
+    getCursorTexture() {
+        return this._cursor?.content;
+    }
+
     setCursorVisible(visible) {
         if (!this._cursor)
             return;
@@ -1812,7 +1816,7 @@ var ScreenshotUI = GObject.registerClass({
 
             const texture = content.get_texture();
 
-            let cursorTexture = this._cursor.content?.get_texture();
+            let cursorTexture = window.getCursorTexture()?.get_texture();
             if (!this._cursor.visible)
                 cursorTexture = null;